#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>
#include <set>
using namespace std;

#define int long long
const int N = 1e5 + 10;
int s[N];
int d[N];
int n;
int h[N], ne[N], e[N], idx;
int color[N];
void add(int a, int b)
{
	e[idx] = b, ne[idx] = h[a], h[a] = idx++;
}
int find(int x)
{
	if (s[x] != x) s[x] = find(s[x]);
	return s[x];
}
void dfs(int u, int c)
{
	cout << u << ' ' << c << '-' << endl;
	color[u] = c;
	for (int i = h[u]; i != -1; i = ne[i])
		if (!color[e[i]])
		{
			if (c == 1)
				dfs(e[i], 2);
			else dfs(e[i], 1);
		}

}
signed main()
{
	cin >> n;
	memset(h, -1, sizeof h);
	for (int i = 1; i <= n; i++)
		s[i] = i;
	bool flag = true;
	for (int i = 0; i < n - 1; i++)
	{
		int u, v;
		cin >> u >> v;
		add(u, v), add(v, u);
		d[u] ++, d[v] ++;
		if (d[u] > 2 || d[v] > 2)
			flag = false;
		if (find(u) != find(v))
			s[u] = find(v);
	}

	set<int> st;
	for (int i = 1; i <= n; i++)
	{
		cout << s[i] << '+';
		st.insert(s[i]);
	}
	if (!flag)
	{
		cout << -1 << endl;
		return 0;
	}
	for (auto q : st)
	{
		cout << q << '*';
		dfs(q, 1);
	}

	for (int i = 1; i <= n; i++)
		if (color[i] == 1)
			cout << 'R';
		else if (color[i] == 2)cout << 'B';
	return 0;
}